home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 79 / maccd 79.iso / multimedial / GL Tron / Source / gltron / pause.c < prev    next >
Encoding:
C/C++ Source or Header  |  2001-05-26  |  2.1 KB  |  104 lines  |  [TEXT/CWIE]

  1. #include "gltron.h"
  2.  
  3. /* very brief - just the pause mode */
  4.  
  5. void idlePause() {
  6. #ifdef SOUND
  7.   soundIdle();
  8. #endif
  9.   /* 
  10.   if(SystemGetElapsedTime() - lasttime < 10) return;
  11.   timediff();
  12.   */
  13.   chaseCamMove();
  14.   if(game->settings->screenSaver && stoptime != 0 &&
  15.      SystemGetElapsedTime() - stoptime > 2000) {
  16.     initData();
  17.     stoptime = 0;
  18.     switchCallbacks(&gameCallbacks);
  19.   }
  20.   SystemPostRedisplay();
  21. }
  22.  
  23. void displayPause() {
  24.   drawGame();
  25.   drawPause(game->screen);
  26.  
  27.   SystemSwapBuffers();
  28. }
  29.  
  30. void keyboardPause(int key, int x, int y) {
  31.   int i;
  32.   switch(key) {
  33.   case 27:
  34.     switchCallbacks(&guiCallbacks);
  35.     break;
  36.   case ' ':
  37.     if(game->pauseflag & PAUSE_GAME_FINISHED)
  38.       initData();
  39.     /* lasttime = SystemGetElapsedTime(); */
  40.     switchCallbacks(&gameCallbacks);
  41.     break;
  42.   case 'q':
  43.     SystemExit();
  44.     break;
  45.   case SYSTEM_KEY_F1: defaultDisplay(0); break;
  46.   case SYSTEM_KEY_F2: defaultDisplay(1); break;
  47.   case SYSTEM_KEY_F3: defaultDisplay(2); break;
  48.   case SYSTEM_KEY_F4: defaultDisplay(3); break;
  49.  
  50.   case SYSTEM_KEY_F10:
  51.     game->settings->camType = (game->settings->camType + 1) % CAM_COUNT;
  52.     for(i = 0; i < game->players; i++)
  53.       game->player[i].camera->camType = game->settings->camType;
  54.     break;
  55.   case SYSTEM_KEY_F12: doScreenShot(game->screen->vp_w, game->screen->vp_h); break;
  56.     
  57.   case SYSTEM_KEY_UP: consoleScrollBackward(1); break;
  58.   case SYSTEM_KEY_DOWN: consoleScrollForward(1); break;
  59.  
  60.   case SYSTEM_KEY_F5: saveSettings(); break;
  61.   case SYSTEM_KEY_TAB: switchCallbacks(&promptCallbacks); break;
  62.   }
  63. }
  64.  
  65. void initPause() {
  66.   fprintf(stderr, "init pause mode\n");
  67. }
  68.  
  69. void exitPause() {
  70. }
  71.  
  72. void initPauseGL() {
  73.   initGLGame();
  74. }
  75.  
  76. callbacks pauseCallbacks = {
  77.   displayPause, idlePause, keyboardPause,
  78.   initPause, exitPause, initPauseGL, gameMouse, gameMouseMotion
  79. };
  80.  
  81. void keyboardPrompt(int key, int x, int y) {
  82.   switch(key) {
  83.   case 27:
  84.   case SYSTEM_KEY_TAB:
  85.     restoreCallbacks();
  86.     break;
  87.   case SYSTEM_RETURN:
  88.     /* promptEvaluate(); */
  89.     break;
  90.   }
  91. }
  92.  
  93. void initPrompt() { }
  94. void exitPrompt() { }
  95.  
  96. callbacks promptCallbacks = {
  97.   displayPause, idlePause, keyboardPrompt,
  98.   initPrompt, exitPrompt, NULL, NULL, NULL
  99. };
  100.  
  101.  
  102.  
  103.  
  104.